package com.hskj.dto;

import lombok.Data;

@Data
public class ResponseDTO {
    private int code;
    private String message; // 成功获取数据 不会显示msg的消息
    private Object data;


    //返回正确数据
    public static ResponseDTO success(Object data){
        ResponseDTO dto=new ResponseDTO();
        dto.setCode(0);
        dto.setData(data);
        return dto;
    }
    //返回错误信息
    public static ResponseDTO error(int code,String message){
        ResponseDTO dto=new ResponseDTO();
        dto.setCode(code);
        dto.setMessage(message);
        return dto;
    }
}
